home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1999 April / Cd Pc Users extra 19 abril 1999.iso / Internet / HTML / HTMLTool / _SETUP.1 / Glower.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-04  |  2.3 KB  |  86 lines

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6.  
  7. public class Glower extends Applet implements Runnable {
  8.    // $FF: renamed from: f java.awt.Font
  9.    Font field_0;
  10.    Color[] colors = new Color[50];
  11.    Thread runThread;
  12.    String Text;
  13.    String FontFace;
  14.    int Size;
  15.  
  16.    public void start() {
  17.       if (this.runThread == null) {
  18.          this.runThread = new Thread(this);
  19.          this.runThread.start();
  20.       }
  21.  
  22.    }
  23.  
  24.    public void stop() {
  25.       if (this.runThread != null) {
  26.          this.runThread.stop();
  27.          this.runThread = null;
  28.       }
  29.  
  30.    }
  31.  
  32.    public void init() {
  33.       if (((Applet)this).getParameter("Size") == null) {
  34.          this.Size = 26;
  35.       } else {
  36.          this.Size = Integer.parseInt(((Applet)this).getParameter("Size"));
  37.       }
  38.  
  39.       this.Text = ((Applet)this).getParameter("Text");
  40.       this.Text = this.Text == null ? "Glower 1.2 (supplied with Lorenz Graf's HTMLtool)" : this.Text;
  41.       this.FontFace = ((Applet)this).getParameter("FontFace");
  42.       this.FontFace = this.FontFace == null ? "TimesRoman" : this.FontFace;
  43.       this.field_0 = new Font(this.FontFace, 1, this.Size);
  44.       float c = 0.0F;
  45.  
  46.       for(int i = 0; i < this.colors.length; ++i) {
  47.          this.colors[i] = Color.getHSBColor(c, 1.0F, 1.0F);
  48.          c = (float)((double)c + 0.02);
  49.       }
  50.  
  51.    }
  52.  
  53.    public void run() {
  54.       int i = 0;
  55.  
  56.       while(true) {
  57.          ((Component)this).setForeground(this.colors[i]);
  58.          ((Component)this).repaint();
  59.          ++i;
  60.  
  61.          try {
  62.             Thread.currentThread();
  63.             Thread.sleep(50L);
  64.          } catch (InterruptedException var2) {
  65.          }
  66.  
  67.          if (i == this.colors.length - 1) {
  68.             i = 0;
  69.          }
  70.       }
  71.    }
  72.  
  73.    public void update(Graphics g) {
  74.       this.paint(g);
  75.    }
  76.  
  77.    public void paint(Graphics g) {
  78.       g.setFont(this.field_0);
  79.       g.drawString(this.Text, 15, 20);
  80.    }
  81.  
  82.    public String getAppletInfo() {
  83.       return "Glower v1.2 copyright 1997 by Lorenz Graf";
  84.    }
  85. }
  86.